package com.whiteape.book.model.dto;

import com.whiteape.book.utils.MapConverter;

import org.greenrobot.greendao.annotation.Convert;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import org.greenrobot.greendao.annotation.Generated;

@Entity
public class SiteSourceBean implements Serializable {
    private static final long serialVersionUID = 211459722873093506L;


    private Boolean enabled;

    private Integer priority;
    /**
     * 书源作者
     */
    private String creator;

    /**
     * 书源站点名称
     */
    private String siteName;
    /**
     * 书源站点url
     */
    @Id
    private String siteHostUrl;

    /**
     * 书源站点icon
     */
    private String siteIconUrl;

    /**
     * 站点类型，0：小说 1：漫画 2：电影
     */
    private int siteType;
    /**
     * 书籍分类信息bean
     */

    /**
     * 站点基本描述比如   韩国漫画资源;  生肉番;  速度超快;
     */
    private String siteDesc;

    @Convert(columnType = String.class, converter = SiteSourceCategoryRuleBean.class)
    private SiteSourceCategoryRuleBean siteCategory;

//    @Convert(columnType = String.class, converter = MapConverter.class)
//    private HashMap<String, String> mediaCategory;

    /**
     * 搜索规则bean
     */
    @Convert(columnType = String.class, converter = SiteSourceSearchBean.class)
    private SiteSourceSearchBean search;

    /**
     * 媒体基础信息bean
     */
    @Convert(columnType = String.class, converter = SiteSourceMediaInfoBean.class)
    private SiteSourceMediaInfoBean mediaInfoDetailRule;

    /**
     * 媒体目录信息bean
     */
    @Convert(columnType = String.class, converter = SiteSourceChapterInfoBean.class)
    private SiteSourceChapterInfoBean chapterInfoRule;

    /**
     * 正文提取信息bean
     */
    @Convert(columnType = String.class, converter = SiteSourceContentInfoBean.class)
    private SiteSourceContentInfoBean contentInfoRule;

//    @Convert(columnType = String.class, converter = SiteSourceHomepageRuleBean.class)
//    private SiteSourceHomepageRuleBean homepage;

//    /**
//     * 分类信息
//     */
//    @Convert(columnType = String.class, converter = SiteSourceCategoryInfoBean.class)
//    private SiteSourceCategoryInfoBean mediaCategoryRule;

    @Generated(hash = 1646845724)
    public SiteSourceBean(Boolean enabled, Integer priority, String creator, String siteName,
            String siteHostUrl, String siteIconUrl, int siteType, String siteDesc,
            SiteSourceCategoryRuleBean siteCategory, SiteSourceSearchBean search,
            SiteSourceMediaInfoBean mediaInfoDetailRule, SiteSourceChapterInfoBean chapterInfoRule,
            SiteSourceContentInfoBean contentInfoRule) {
        this.enabled = enabled;
        this.priority = priority;
        this.creator = creator;
        this.siteName = siteName;
        this.siteHostUrl = siteHostUrl;
        this.siteIconUrl = siteIconUrl;
        this.siteType = siteType;
        this.siteDesc = siteDesc;
        this.siteCategory = siteCategory;
        this.search = search;
        this.mediaInfoDetailRule = mediaInfoDetailRule;
        this.chapterInfoRule = chapterInfoRule;
        this.contentInfoRule = contentInfoRule;
    }

    public SiteSourceBean() {
    }

    public Integer getPriority() {
        return priority;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }


    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getSiteName() {
        return siteName;
    }

    public void setSiteName(String siteName) {
        this.siteName = siteName;
    }

    public String getSiteHostUrl() {
        return siteHostUrl;
    }

    public void setSiteHostUrl(String siteHostUrl) {
        this.siteHostUrl = siteHostUrl;
    }

    public String getSiteIconUrl() {
        return siteIconUrl;
    }

    public void setSiteIconUrl(String siteIconUrl) {
        this.siteIconUrl = siteIconUrl;
    }

    public int getSiteType() {
        return siteType;
    }

    public void setSiteType(int siteType) {
        this.siteType = siteType;
    }

    public String getSiteDesc() {
        return siteDesc;
    }

    public void setSiteDesc(String siteDesc) {
        this.siteDesc = siteDesc;
    }

    public SiteSourceSearchBean getSearch() {
        return search;
    }

    public void setSearch(SiteSourceSearchBean search) {
        this.search = search;
    }

    public SiteSourceMediaInfoBean getMediaInfoDetailRule() {
        return mediaInfoDetailRule;
    }

    public void setMediaInfoDetailRule(SiteSourceMediaInfoBean mediaInfoDetailRule) {
        this.mediaInfoDetailRule = mediaInfoDetailRule;
    }

    public SiteSourceChapterInfoBean getChapterInfoRule() {
        return chapterInfoRule;
    }

    public void setChapterInfoRule(SiteSourceChapterInfoBean chapterInfoRule) {
        this.chapterInfoRule = chapterInfoRule;
    }

    public SiteSourceContentInfoBean getContentInfoRule() {
        return contentInfoRule;
    }

    public void setContentInfoRule(SiteSourceContentInfoBean contentInfoRule) {
        this.contentInfoRule = contentInfoRule;
    }


    public SiteSourceCategoryRuleBean getSiteCategory() {
        return siteCategory;
    }

    public void setSiteCategory(SiteSourceCategoryRuleBean siteCategory) {
        this.siteCategory = siteCategory;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SiteSourceBean that = (SiteSourceBean) o;
        return Objects.equals(siteHostUrl, that.siteHostUrl);
    }


    @Override
    public int hashCode() {
        return Objects.hash(siteHostUrl);
    }

    @Override
    public String toString() {
        return "SiteSourceBean{" +
                "creator='" + creator + '\'' +
                ", siteName='" + siteName + '\'' +
                ", siteHostUrl='" + siteHostUrl + '\'' +
                ", siteIconUrl='" + siteIconUrl + '\'' +
                ", siteType=" + siteType +
                ", search=" + search +
                ", mediaInfoDetailRule=" + mediaInfoDetailRule +
                ", chapterInfoRule=" + chapterInfoRule +
                ", contentInfoRule=" + contentInfoRule +
                '}';
    }

    public Boolean getEnabled() {
        return this.enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

}
